package Observer_Pattern.Shares;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class software extends AbstractTraget{
    public software(double number){
        this.setNum(number);
    }

    @Override
    public void play(Double num) {
        System.out.println("该股票目前价格为"+num);
        System.out.println("之前价格为"+this.getNum());
        double a=(Math.abs(this.getNum()-num))/this.getNum();
        System.out.println("变化为"+a*100+"%");
        if(a>=0.05){
            System.out.println("变化大于5%");
            for (Object obs:abc){
                ((Observe)obs).show();
                this.setNum(num);
                System.out.println("调整当前价格为"+this.getNum());
            }
        }
        else{
            System.out.println("变化小于5%，不通知");
        }
    }
}
